class Login{
  constructor(){
    this.submit()
  }

  submit(){
    $('#login-form').on('submit',(e)=>{
      const username =$('#inputUsername').val()
      const password =$('#inputPassword').val()
      $.post('/api/v1/user/login',{username,password},(resp)=>{
        console.log(resp)
        if(resp.code===200){
          alert(resp.body.userinfo.displayName +',即将跳转至主界面')
          window.location.href='/'
        }
      })
      e.preventDefault()
    })
  }
}
new Login()

